<template>
    <div class="show">
    <group title="问题反馈">
      <x-textarea :max="300" name="detail" v-model="mes.content"  :show-counter="true"></x-textarea>
    </group>
   <cell> 
    <x-button type="primary" mini @click.native="send">发送</x-button>
    </cell>
    <div v-transfer-dom>
      <alert v-model="show" title="错误">内容不能为空！</alert>
    </div>
    </div>
</template>
<script>
 import {XTextarea, Group, XButton, Cell, Alert, TransferDomDirective as TransferDom} from 'vux'
export default{
   directives: {
     TransferDom
   },
   components: {
     XTextarea,
     Group,
     XButton,
     Cell,
     Alert
   },
   methods: {
     send () {
       if (this.mes.content === '') {
         this.show = true
       } else {
         this.$http.post('/api/sys/advice', this.mes).then((res) => {
           if (res.data.code === 0) {
             alert('发送成功！')
             this.mes.content = ''
           } else {
             alert('提交出错，请重试！！')
           }
         })
       }
     }
   },
   data () {
     return {
       show: false,
       mes: {
         content: ''
       }
     }
   }
}
</script>
<style>
.show{
    padding-top: 40px;
}
</style>
